<template>
<div>
    <section class="content-header">
        <h1>修改景区</h1>
    </section>

    <section class="content">
        <div class="box box-primary">
            <form class="form-horizontal" name="regions_creat_form" novalidate="novalidate">
                <div class="box-body">
                    <div class="form-group pt7">
                        <label for="code" class="col-sm-2 control-label">景区编号</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="code" name="code" v-model="region.code" placeholder="景区编号" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">景区封面</label>
                        <div class="col-sm-9 pt7">
                            <!--<uploader-img :val="region.cover_image" multi="true"></uploader-img>-->
                        </div>
                    </div>
                    <!--<div class="form-group">
                        <label class="col-sm-2 control-label">景区缩略图</label>
                        <div class="col-sm-9 pt7">
                            <div class="img-content-thumb" style="margin-bottom: 10px;" ng-if="region.thumbnail != null && region.thumbnail != ''">
                                <span class="pull-left">原缩略图：</span><img ng-src="{{region.thumbnail}}?imageView2/2/w/100/h/100" width="100" height="100" />
                            </div>
                            <uploader-img val="region.thumbnail"></uploader-img>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">景区内容</label>
                        <div class="col-sm-9">
                            <textarea id="editor"></textarea>
                        </div>
                    </div>-->
                </div>
                <div class="box-footer">
                    <button type="submit" class="btn btn-primary pull-right">修 改</button>
                </div>
            </form>
        </div>
    </section>
</div>
</template>

<script>
var Vue = require('vue');
var RegionsEdit = Vue.component('regionsEdit', {
    data : function(){return {region : {}};},
    created : function () {
        // 组件创建完后获取数据，
        // 此时 data 已经被 observed 了
        this.fetchData()
    },
    /*watch: {
     // 如果路由有变化，会再次执行该方法
     '$route': 'fetchData'
     },*/
    methods: {
        fetchData:function () {
            var _this = this;
            regionsResource.getRegion(_this.$route.params.region_id).then(function(response){
                _this.region = response.data;
            });
        }
    }
});
</script>